<?php
require_once('../admin/inc/common.php');
require_once('../admin/inc/theme_functions.php');

ob_start();
get_component('contact_form_email_destination');
$to = trim(ob_get_contents());
ob_end_clean();
$subject = 'Nouveau message d\'un visiteur';

//echo "send to " .$to;
$message = "<strong>Nom:</strong> ".$_POST["contact_name"]."<br/><br/>";
$message .= "<strong>Email:</strong> ".$_POST["contact_email"]."<br/><br/>";
$message .= "<strong>Téléphone:</strong> ".$_POST["contact_phone"]."<br/><br/>";
$message .= "<strong>IP Client:</strong> ".$_SERVER['REMOTE_ADDR']."<br/><br/>";
$message .= "<strong>Message:</strong><br/><br/>".nl2br($_POST["contact_message"]);

$headers = 'From: Love2Dance Website <noreply@love2dance.com>' . "\r\n";
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

if(mail($to, $subject, $message, $headers)) {
	echo "OK";
} else {
	echo "KO";
}

?>